// @ts-ignore
import Config from '@/config'
import tool from '@/utils/tool'
// @ts-ignore
import { createI18n } from 'vue-i18n'
import el_zh_cn from 'element-plus/lib/locale/lang/zh-cn'
import el_en from 'element-plus/lib/locale/lang/en'
// @ts-ignore
import zh_cn from './lang/zh_cn'
// @ts-ignore
import en from './lang/en'

const messages = {
    'zh_CN': {
        el: el_zh_cn,
        ...zh_cn
    },
    'en': {
        el: el_en,
        ...en
    }
}

const i18n = createI18n({
    locale: tool.data.get("APP_LANG") || Config.LANG,
    fallbackLocale: 'zh_CN',
    globalInjection: true,
    messages,
})

export default i18n;